home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
The World of Computer Software.iso
/
pbaseiv.zip
/
P4DOS001.TIP
< prev
next >
Wrap
Text File
|
1991-12-16
|
3KB
|
66 lines
Dear Friends:
In the item "Improving WHEREIS" [Star-Dot-Star, November
1989], John East reveals some, but not all, of ATTRIB's
hidden possibilities. This command is the unexploited gold
mine of DOS commands.
For example, ATTRIB lets you batch process a routine that
otherwise must be done a file at a time. Suppose you have a
program that accepts individual files for processing but
can't handle wild cards. (We have many such programs in
Russia--for example, PRRUS.COM, which I use to print Russian
fonts.) The standard solution is to create a batch file that
calls a program like PRRUS for each file in a directory.
ATTRIB lets me create such batch files automatically.
First, I make a copy of the program file I want to run and
rename it A.COM or A.EXE. Next, I copy to a temporary
directory all the files I want to process (this isn't
strictly necessary, but I recommend it as a safety measure).
I then enter the command attrib +a -r *.* (or *.TXT, or
whatever). This switches on the archive bit for each file.
Then, I enter attrib *.* > otp.bat to create a batch file
named OTP.BAT. You can use another name if you like. The
file will contain lines like these: A c:\Spath\Sfilename1 A
c:\Spath\Sfilename2
The `A' in these lines represents the file's archive flag,
which the first ATTRIB command switched on. However, since
I've renamed my executable file to `A', executing the
ATTRIB-created batch file passes all my file names to the
program for processing, and I don't have to type a single
one.
Vadim V. Kayuitkin
Sverdlovsk, U.S.S.R.
Editor's note: The `-r' option in the first ATTRIB command
is needed only if some files are set to read-only status,
but it does no harm to include this option, especially if
you've copied your files to another directory first. DOS's
read-only setting is pretty worthless, anyway; programs can
circumvent it without even knowing it.
Be aware that renaming some programs may cause them to fail
if they search for their own files--for configuration
information, for instance. In that case, instead of renaming
your program, edit the batch file, replacing each `A' with
your program's real name. Also, never change an executable
program's extension. It's probably OK to rename MYPROG.EXE
to A.EXE and MYPROG.COM to A.COM, but never rename an EXE
extension to COM or vice versa. And whatever the program
file is called, it must be in a directory on your PATH.
Try this tip even if you don't need to pass multiple files
to programs in exactly this way. As Mr. Kayuitkin suggests,
ATTRIB is truly golden for creating lists of file path
names--a trick that no other DOS command performs with the
same ease.
Title: A is for Action
Category: DOS
Issue date: Feb 1991
Editor: Tom Swan
Supplementary files: NONE